﻿using CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinWeb.WebData;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CyberWin.Trade.IDE.Server
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //  未来之窗商业服务核心.Stop();
                未来之窗商业服务核心 = new CyberWin_ServiceMain();
                //MessageBox.Show("889");
                未来之窗商业服务核心.Cyber_Load(true);
                未来之窗商业服务核心.Start();
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.Message);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        CyberWin_ServiceMain 未来之窗商业服务核心;

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                未来之窗商业服务核心.Stop();
                Application.Exit();
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.Message);
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ide_add收藏("eee", "ee", "测试", "FOLDER", "D:\\DDD\\");
        }
        public static void ide_初始化()
        {
            string 数据库路径 = Application.StartupPath + "/cyberwinide_setting.whcv";
            string dbType = "SQLite";
            string[] conn = new string[1];
            conn[0] = 数据库路径;
            Cyber_DataBase cdb = new Cyber_DataBase(dbType, conn);

            //CyberWin.Trade.Local.BaseMaterialManagement.CyberWin_Common.Cyber_Public.设置全局数据库();
        }
        public static void ide_add收藏(string token, string 项目, string 标题, string type, string 路径)
        {
            ide_初始化();
            //cyberwin_ide_favourite
            //cyberwin_ide_history
            //cyberwin_ide_settings
            Cyber_M db = new Cyber_M("ide_favourite", "cyberwin_");
            NameValueCollection 收藏 = new NameValueCollection();
            收藏.Add("token", token);
            收藏.Add("项目", 项目);
           收藏.Add("标题", 标题);
           收藏.Add("类型", type);
            收藏.Add("路径", 路径);
            收藏.Add("create_time", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.Add(收藏);



        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void 隐藏ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void 显示ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Show();
        }

        private void 启动ToolStripMenuItem_Click(object sender, EventArgs e)
        {

            try
            {
                //  未来之窗商业服务核心.Stop();
                未来之窗商业服务核心 = new CyberWin_ServiceMain();
                //MessageBox.Show("889");
                未来之窗商业服务核心.Cyber_Load(true);
                未来之窗商业服务核心.Start();
            }
            catch (Exception EX)
            {
            }
        }

        private void 停止ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            未来之窗商业服务核心.Stop();
            Application.Exit();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
